package com.zjj.learn.designmodel.pattern.singleton.demo3;

/** 懒汉式
 * *** @author zjj_admin
 * *** 2022/4/5 15:15
 */
public class Singleton {

    //私有化构造方法
    private Singleton(){}
    //声明该类型的变量
    public static Singleton instance;

    public static synchronized Singleton getInstance(){
        if(null == instance){
            instance = new Singleton();
        }
        return instance;
    }

}
